home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 19
/
CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso
/
CUCD
/
Programming
/
LEDA
/
prog
/
graph
/
embedding.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-05
|
718b
|
46 lines
#include <LEDA/graph.h>
#include <LEDA/graph_alg.h>
main()
{
GRAPH<int,int> G;
int n = read_int("n = ");
random_planar_graph(G,n);
list<edge> el = G.all_edges();
edge e;
forall(e,el) G.new_edge(target(e),source(e));
if ( ! PLANAR(G,true) )
{ cout << "Graph is not planar\n";
exit(1);
}
node v;
node a,b,c;
node_array<int> x(G),y(G);
float T = used_time();
cout << "OLD EMBEDDING ";
cout.flush();
STRAIGHT_LINE_EMBEDDING(G,x,y);
cout << string("%6.2f sec \n",used_time(T));
cout << "NEW EMBEDDING ";
cout.flush();
STRAIGHT_LINE_EMBEDDING2(G,a,b,c,x,y);
cout << string("%6.2f sec \n",used_time(T));
/*
forall_nodes(v,G) cout << string("x = %2d y = %2d\n",x[v],y[v]);
*/
return 0;
}